﻿Namespace Global.Runa.UI.Threading

    Public NotInheritable Class DispatcherUnhandledExceptionEventArgs
        Inherits DispatcherEventArgs

        Private _exception As Exception
        Private _handled As Boolean

        Friend Sub New(ByVal dispatcher As Dispatcher)
            MyBase.New(dispatcher)
        End Sub

        Friend Sub Initialize(ByVal exception As Exception, ByVal handled As Boolean)
            Me._exception = exception
            Me._handled = handled
        End Sub

        Public ReadOnly Property Exception As Exception
            Get
                Return Me._exception
            End Get
        End Property

        Public Property Handled As Boolean
            Get
                Return Me._handled
            End Get
            Set(ByVal value As Boolean)
                If value Then
                    Me._handled = value
                End If
            End Set
        End Property

    End Class

    Public Delegate Sub DispatcherUnhandledExceptionEventHandler(ByVal sender As Object, ByVal e As DispatcherUnhandledExceptionEventArgs)

End Namespace